package com.ayic.garbagerecycle.controller;

import com.ayic.garbagerecycle.pojo.Result;
import com.ayic.garbagerecycle.pojo.User;
import com.ayic.garbagerecycle.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin(origins = "*", allowedHeaders = "*")
@RequestMapping("/login")
@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;

    @PostMapping
    public Result login(@RequestBody User user) {
        return loginService.login(user.getUsername(), user.getPassword());
    }
}
